package live.zs.mybatisplusboot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import live.zs.mybatisplusboot.entity.TbUser;
import live.zs.mybatisplusboot.mapper.TbUserMapper;
import live.zs.mybatisplusboot.service.ITbUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 自定义配置BiConsumer tableInfo comment 服务实现类
 * </p>
 *
 * @author madison
 * @since 2021-07-09 13:43:22
 */
@Service
public class TbUserServiceImpl extends ServiceImpl<TbUserMapper, TbUser> implements ITbUserService {

    @Autowired
    private TbUserMapper userMapper;

    @Override
    public PageDTO<TbUser> userList(PageDTO pageDTO) {
        LambdaQueryWrapper<TbUser> wrapper = Wrappers.lambdaQuery();
//        wrapper.select(TbUser::getUserId, TbUser::getAge).eq(TbUser::getAge, "18");
        wrapper.orderByDesc(TbUser::getCreateTime);
        PageDTO page = userMapper.selectPage(pageDTO, wrapper);
        return page;
    }
}
